package com.framework.spring.mybatis.util;

import org.springframework.beans.factory.FactoryBean;

/**
 * 需要被spring识别
 * mapperInterface必须有值
 * @param <T>
 */
//@Component
public class MyFactoryBean<T> implements FactoryBean<T> {

	Class<T> mapperInterface;

	public void setMapperInterface(Class<T> mapperInterface) {
		this.mapperInterface = mapperInterface;
	}

	@Override
	public T getObject() throws Exception {
		return (T) MysqlSession.getMapper(mapperInterface );
	}

	@Override
	public Class<T> getObjectType() {
		return mapperInterface;
	}

}
